package com.woniu.product.controller;

import com.woniu.common.util.ResponseData;
import com.woniu.product.pojo.TProductBrand;
import com.woniu.product.service.TProductBrandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author 杜梅杰
 * @Description
 * @Date 2024/5/20 19:04
 */
@RestController
public class BrandController {
    @Autowired
    private TProductBrandService brandService;

    /**
     * 根据种类查品牌
     */
    @PostMapping("/queryBrands")
    public ResponseData<TProductBrand> queryBrands(String sortId) {
        List<TProductBrand> brandList = brandService.lambdaQuery().
                eq(TProductBrand::getState,1).
                eq(TProductBrand::getSortId, sortId).list();
        return new ResponseData<>().ok(brandList);
    }
}
